<template>
<div>
  <a-table  :row-selection="rowSelection" :columns="columns" :data-source="data" :scroll="{ x: 2000 }">
    <!-- <a slot="action" slot-scope="text" href="javascript:;">
        调价
    </a>| -->
    <template slot="action" slot-scope="text" :text="text">
        <a href="javascript:;" style="margin-right:20px" @click="adjustPrice"> 调价</a>  
         <a-dropdown>
          <a class="ant-dropdown-link">更多
            <a-icon type="down" />
          </a>
          <a-menu slot="overlay">
            <a-menu-item>
              <a @click="handleDetail()">调价记录</a>
            </a-menu-item>
            <a-menu-item>

              <a @click="handleUndercarriage(record.id, 'N')">上架</a>

            </a-menu-item>
            <a-menu-item>
              <a @click="handleUndercarriage(record.id, 'Y')">下架</a>
            </a-menu-item>
            <a-menu-item>
              <a @click="isDelete(record)">删除</a>
            </a-menu-item>
          </a-menu>
        </a-dropdown>
    </template>
    <!-- 调价记录的弹窗 -->
  </a-table>
    <AdjustTheRecordPopUp ref="adjest" ></AdjustTheRecordPopUp>
    <!-- 调价弹窗 -->
    <adjustTheRecordPopUpWindow ref="adjestWindown"></adjustTheRecordPopUpWindow>
    <secondaryToAsk>
        <a href="#">傻蛋</a>
    </secondaryToAsk>
        
</div>
</template>
<script>
import adjustTheRecordPopUpWindow from './common/adjustPricePoPUpWindow.vue';
import AdjustTheRecordPopUp from './common/adjustTheRecordPopUp.vue'
import secondaryToAsk from './common/secondaryToAsk.vue'
const columns = [
  { title: '序号', width: 100, dataIndex: 'name', key: '0',  },
  { title: '商品名称', dataIndex: 'address', key: '1' },
  { title: 'SPU码', dataIndex: 'address', key: '2' },
  { title: '商品状态', dataIndex: 'address', key: '3' },
  { title: '采购价', dataIndex: 'address', key: '4' },
  { title: '分销价', dataIndex: 'address', key: '5' },
  { title: '商品原价', dataIndex: 'address', key: '6' },
  { title: '售价', dataIndex: 'address', key: '7' },
  { title: '分类', dataIndex: 'address', key: '8' },
  { title: '品牌名称', dataIndex: 'address', key: '9' },
  { title: '单位', dataIndex: 'address', key: '10' },
  { title: '规格类型', dataIndex: 'address', key: '11' },
  { title: '商品来源', dataIndex: 'address', key: '12' },
  { title: 'ERP商品编码', dataIndex: 'address', key: '13' },
  { title: '更新时间', dataIndex: 'address', key: '14' },
  {
    title: '操作',
    key: 'operation',
    fixed: 'right',
    width: 150,
    scopedSlots: { customRender: 'action' },
  },
];

const data = [
  {
    key: '1',
    name: 'John Brown',
    age: 32,
    address: 'New York Park',
  },
  {
    key: '2',
    name: 'Jim Green',
    age: 40,
    address: 'London Park',
  },
];

export default {
  data() {
    return {
      data,
      columns,
    };
  },
  components:{AdjustTheRecordPopUp,secondaryToAsk,adjustTheRecordPopUpWindow},
  computed: {
    rowSelection() {
      return {
        onChange: (selectedRowKeys, selectedRows) => {
          console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
        },
        getCheckboxProps: record => ({
          props: {
            disabled: record.name === 'Disabled User', // Column configuration not to be checked
            name: record.name,
          },
        }),
      };
    },
  },
  methods:{
      handleDetail(){
          console.log('zazaza  ----->  ');
          this.$nextTick(()=>{
              console.log(this.$refs.adjest.visible);
              this.$refs.adjest.visible=true
          })
      },
      handleUndercarriage(){},
      handleUndercarriage(){},
      isDelete(){},
      adjustPrice(){
          console.log(' 调整价格 ----->  ', );
          this.$refs.adjestWindown.visible=true
      }
  }
};
</script>
